﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json;

namespace PProdAPI.Models
{
    public class OnlyDateConverter : IsoDateTimeConverter
    {
        public OnlyDateConverter()
        {
            DateTimeFormat = "yyyy-MM-dd";
        }
    }
    public class employee
    {
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        [Display(Name = "Employee ID")]
        [Required]
        public int Id { get; set; }
        [Required]
        public string Name { get; set; }
        [JsonConverter(typeof(OnlyDateConverter))]
        public DateTime HireDate { get; set; }
        public decimal Price { get; set; }
        
    }
    public class shift
    {
        [ScaffoldColumn(false)]
        public int Id { get; set; }
        [Required]
        public string ShiftName { get; set; }
        public string NickName { get; set; }
        public bool DayShift { get; set; }
        
    }
    public class machine
    {
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        [Display(Name = "Machine ID")]
        public int Id { get; set; }
        [Required]
        public string MachineName { get; set; }
    }
    public class item
    {
        [ScaffoldColumn(false)]
        public int Id { get; set; }
        [Required]
        public string ItemID { get; set; }
        public string Description { get; set; }
        public decimal MinimumStock { get; set; }
        public decimal MaximumStock { get; set; }
        public decimal PalletWeight { get; set; }
    }
    public class production
    {
        [ScaffoldColumn(false)]
        public int Id { get; set; }
        [JsonConverter(typeof(OnlyDateConverter))]
        public DateTime createdate { get; set; }
        [JsonConverter(typeof(OnlyDateConverter))]
        [Required]
        public DateTime date { get; set; }
        [Required]
        public int employeeId { get; set; }
        public virtual employee employee { get; set; }
        [Required]
        public int shiftId { get; set; }
        public virtual shift shift { get; set; }
        [Required]
        public int machineId { get; set; }
        public virtual machine machine { get; set; }
        public int itemId { get; set; }
        public virtual item item { get; set; }
        [Required]
        public decimal amount { get; set; }
        [Required]
        public decimal actualHours { get; set; }
        [Required]
        public decimal scheduledHours { get; set; }
    }
}